import request from '@/utils/request'

// 获取角色列表
export const getRolesAPI = data => {
  return request({
    url: '/sys/role',
    method: 'GET',
    params: data
  })
}

// 公司信息
export const getCompanyInfoAPI = id => {
  return request({
    url: `/company/${id}`,
    method: 'GET'
  })
}

// 添加角色
export const addRoleAPI = data => {
  return request({
    url: '/sys/role',
    method: 'POST',
    data
  })
}

// 角色详情
export const getRoleIdAPI = id => {
  return request({
    url: `/sys/role/${id}`,
    method: 'GET'
  })
}

// 编辑角色
export const updateRoleAPI = data => {
  return request({
    url: `/sys/role/${data.id}`,
    method: 'PUT',
    data
  })
}

// 删除角色
export const deleteRoleAPI = id => {
  return request({
    url: `/sys/role/${id}`,
    method: 'DELETE'
  })
}

// 角色设置权限
export const assignPermAPI = data => {
  return request({
    url: '/sys/role/assignPrem',
    method: 'PUT',
    data
  })
}
